﻿using Furion.DatabaseAccessor;
using Furion.DistributedIDGenerator;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ST.Torch.WebApi.Core.Entities
{
	/// <summary>
	/// 实体类型
	/// </summary>
	public abstract partial class BaseEntity : IEntity<MasterDbContextLocator>
	{
		public Guid Id { get; set; }
		public DateTime? CreateTime { get; set; }
		public DateTime? UpdateTime { get; set; }
		public BaseEntity()
		{
			Id = IDGen.NextID();
			CreateTime = DateTime.Now;
			UpdateTime = DateTime.Now;
		}
	}
	/// <summary>
	/// 实体类型
	/// </summary>
	public abstract partial class SoftDeleteBaseEntity : BaseEntity
	{
		public bool IsDeleted { get; set; }
		public DateTime? DeleteTime { get; set; }

		public SoftDeleteBaseEntity()
		{
			IsDeleted = false;
		}

		public string[] Delete()
		{
			IsDeleted = true;
			DeleteTime = DateTime.Now;
			return new[] { nameof(IsDeleted), nameof(DeleteTime) }; 
		}
		public void GetUpdateDeleteField()
		{
			
			
		}
	}
	
}
